package com.linzm.creationaltype.abstractfactory02.enums;

import com.linzm.creationaltype.abstractfactory02.factory.ColorFactory;
import com.linzm.creationaltype.abstractfactory02.factory.ShapeFactory;

/**
 * @Author zimingl
 * @Date 2023/4/15 12:32
 * @Description: 工厂枚举类型
 */
public enum FactoryTypeEnum implements TypeInterface {
    COLOR_FACTORY("colorFactory", "颜色工厂", ColorFactory.class),
    SHAPE_FACTORY("shapeFactory", "图形工厂", ShapeFactory.class);

    FactoryTypeEnum(String type, String desc, Class<?> clazz) {
        this.type = type;
        this.desc = desc;
        this.clazz = clazz;
    }

    private final String type;

    private final String desc;

    private final Class<?> clazz;

    @Override
    public Class<?> getClazz() {
        return clazz;
    }

    @Override
    public TypeInterface getEnum(String type) {
        return FactoryTypeEnum.valueOf(type);
    }
}
